import request from '@/utils/request'
import { makeFormData } from '@/utils/util'

const api = {
  attachmentList: 'crm/web/attachment/page', // 附件列表
  leadsHistory: 'crm/web/leadsHistory/find_by_leadsId', // 跟进记录
  leadsHistoryByClient: 'crm/web/leadsHistory/find_by_clientelesId',
  leadsHistoryByContract: 'crm/web/contract_history/find_by_contract',
  staffList: 'web/staff/area_staff',
  attachmentAdd: 'crm/web/attachment/add',
  transferStaffList: 'web/staff/area_staff_by_permission' // 人员信息
}

export function getTransferStaffList (data = {}) {
  return request({
    url: api.transferStaffList,
    method: 'get',
    params: data
  })
}

export function leadsHistory (data = {}, type = 'leadsHistory') {
  return request({
    url: api[type],
    method: 'post',
    data: makeFormData(data)
  })
}

export function aboutVisitupdateList (params = {}) {
  return request({
    url: 'crm/aboutVisit/updateLeads',
    method: 'post',
    data: params
  })
}

export function aboutPalletupdate (params = {}) {
  return request({
    url: 'crm/aboutPallet/updateLeads',
    method: 'post',
    data: params
  })
}
